package com.ryskoo.catering.orderlog.service;

import com.ryskoo.catering.orderlog.domain.OrderLogPO;
import com.ryskoo.catering.orderlog.repository.IOrderLogRepository;
import com.ryskoo.framework.core.service.BasicServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import java.util.List;

/**
 * @author BeHappy
 */
@Service
public class OrderLogServiceImpl extends BasicServiceImpl<OrderLogPO> implements IOrderLogService {
    @Autowired
    private IOrderLogRepository orderLogRepository;

    @PostConstruct
    public void init() {
        this.setDao(orderLogRepository);
    }

    @Override
    public List<OrderLogPO> getLogListByOrderUuid(String orderUuid) {
        return orderLogRepository.getLogListByOrderUuid(orderUuid);
    }

    @Override
    public void createLog(String orderUuid, String operatorUuid, String operatorName, String operateLog) {
        OrderLogPO log = new OrderLogPO();
        log.setOrderUuid(orderUuid);
        log.setOperatorUuid(operatorUuid);
        log.setOperatorName(operatorName);
        log.setOperateLog(operateLog);
        this.create(log);
    }
}
